package net.models;

// Generated 27 mars 2014 09:40:52 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Userstory generated by hbm2java
 */
@Entity
@Table(name = "userstory", catalog = "scrumtool")
public class Userstory implements java.io.Serializable {

	private Integer id;
	private Sprint sprint;
	private Product product;
	private Status status;
	private String label;
	private String description;
	private Integer storyPoints;
	private Integer priority;
	private Date finishedAt;
	private Set<Comment> comments = new HashSet<Comment>(0);
	private Set<Collaborator> collaborators = new HashSet<Collaborator>(0);

	public Userstory() {
	}

	public Userstory(Status status) {
		this.status = status;
	}

	public Userstory(Sprint sprint, Product product, Status status,
			String label, String description, Integer storyPoints,
			Integer priority, Date finishedAt, Set<Comment> comments,
			Set<Collaborator> collaborators) {
		this.sprint = sprint;
		this.product = product;
		this.status = status;
		this.label = label;
		this.description = description;
		this.storyPoints = storyPoints;
		this.priority = priority;
		this.finishedAt = finishedAt;
		this.comments = comments;
		this.collaborators = collaborators;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idSprint")
	public Sprint getSprint() {
		return this.sprint;
	}

	public void setSprint(Sprint sprint) {
		this.sprint = sprint;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idProduct")
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idStatus", nullable = false)
	public Status getStatus() {
		return this.status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	@Column(name = "label")
	public String getLabel() {
		return this.label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	@Column(name = "description", length = 65535)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "storyPoints")
	public Integer getStoryPoints() {
		return this.storyPoints;
	}

	public void setStoryPoints(Integer storyPoints) {
		this.storyPoints = storyPoints;
	}

	@Column(name = "priority")
	public Integer getPriority() {
		return this.priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "finishedAt", length = 10)
	public Date getFinishedAt() {
		return this.finishedAt;
	}

	public void setFinishedAt(Date finishedAt) {
		this.finishedAt = finishedAt;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userstory")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "realize", catalog = "scrumtool", joinColumns = { @JoinColumn(name = "idUserStory", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "idCollaborator", nullable = false, updatable = false) })
	public Set<Collaborator> getCollaborators() {
		return this.collaborators;
	}

	public void setCollaborators(Set<Collaborator> collaborators) {
		this.collaborators = collaborators;
	}

}
